package com.baizan.daka.ui.presenter

import com.baizan.daka.base.BasePresenter
import com.baizan.daka.mvp.model.MeModel
import com.baizan.daka.mvp.model.bean.ShowCashBean
import com.baizan.daka.net.BasePageResponse
import com.baizan.daka.rx.Subscriber.CommonSubscriber
import com.baizan.daka.showToast
import com.baizan.daka.ui.contract.ShowCashContract

class ShowCashPresenter(val mView: ShowCashContract.View) : BasePresenter(),
    ShowCashContract.Presenter {


    val meModel: MeModel by lazy { MeModel() }


    override fun loadList(pageNo: Int, auditState: String?) {
        mView.showLoadingDialog()
        meModel.getShowCashList(auditState, pageNo)
            .subscribe(object :
                CommonSubscriber<BasePageResponse<ShowCashBean>>(compositeDisposable) {
                override fun onCallNext(t: BasePageResponse<ShowCashBean>?) {
                    mView.loadSuccess(t!!)
                }

                override fun onCallCompleted() {
                    super.onCallCompleted()
                    mView.hideLoadingDialog()
                }

                override fun onCallError(e: String) {
                    super.onCallError(e)
                    showToast(e)
                }

            })
    }


}

